﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace FrameWork.Setting
{

    /// <summary>
    /// 表示一个设定编辑器
    /// </summary>
    public class SettingEditorBase:System.Windows.Forms.UserControl
    {
    }

    /// <summary>
    /// 表示一个设定编辑项
    /// </summary>
    public abstract class SettingEditorItem
    {
        /// <summary>
        /// 表示与设定编辑项关联的设定编辑器
        /// </summary>
        protected SettingEditorBase Editor { get; set; }
        /// <summary>
        /// 表示该设定编辑项是否已被编辑
        /// </summary>
        public bool IsChanged { get; internal set; }
        /// <summary>
        /// 表示该设定项是否已经载入设定
        /// </summary>
        public bool IsLoaded { get; internal set; }
        /// <summary>
        /// 保存设定
        /// </summary>
        /// <returns></returns>
        public abstract bool SaveSetting(SettingOperatorBase SettingOper);
        /// <summary>
        /// 读取设定
        /// </summary>
        /// <returns></returns>
        public abstract bool LoadSetting(SettingOperatorBase SettingOper);
        /// <summary>
        /// 应用设定
        /// </summary>
        /// <returns></returns>
        public abstract bool AcceptSetting();
        /// <summary>
        /// 重置编辑器
        /// </summary>
        /// <returns></returns>
        public abstract bool ResetEditor();
        /// <summary>
        /// 还原默认设定
        /// </summary>
        /// <returns></returns>
        public abstract bool ResetToDefault();
        /// <summary>
        /// 获取显示名称
        /// </summary>
        /// <returns></returns>
        public abstract string GetShowName();

        /// <summary>
        /// 向同程序集的成员公开编辑器
        /// </summary>
        /// <returns></returns>
        internal SettingEditorBase GetEditor()
        {
            return Editor;
        }

    }
}
